package 等待通知_卖包子;

public class 消费者 extends Thread {
    private ZhengTi<BaoZi> zt;

    public 消费者(ZhengTi<BaoZi> zt) {
        this.zt = zt;
    }

    @Override
    public void run() {
        int i=0;
        while (i<5){
            i++;
            BaoZi bz=zt.take();
            System.out.println(Thread.currentThread().getName()+"吃了"+bz);
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
